// source --> https://www.omicroner-garagen.de/wp-content/plugins/contact-form-maker/js/main_div_front_end.js?ver=1.11.11 F=2; var c; var a = new Array(); var rated=false; function set_total_value(form_id) { var FormCurrency = eval("FormCurrency_" + form_id); if(jQuery('.paypal_total'+form_id).length==0) { return; } var div_paypal_show = jQuery('.paypal_total'+form_id); var div_paypal_products = jQuery('.paypal_products'+form_id); var div_paypal_tax = jQuery('.paypal_tax'+form_id); var input_paypal_total = jQuery('.input_paypal_total'+form_id); var total=0; var total_shipping=0; div_paypal_products.html(''); div_paypal_tax.html(''); n = parseInt(jQuery('#counter'+form_id).val()); jQuery("#form" +form_id+ " div[type='type_paypal_checkbox'], #form" +form_id+ " div[type='type_paypal_radio']").each(function() { id=jQuery(this).parent().attr('wdid'); jQuery(this).find('input:checked').each( function() { label= jQuery("label[for='"+jQuery(this).attr('id')+"']").html(); span_value = FormCurrency + jQuery(this).val()+(jQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? ' x'+jQuery('#wdform_'+id+"_element_quantity"+form_id).val() : ''); total =total + jQuery(this).val() * parseInt((jQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? jQuery('#wdform_'+id+"_element_quantity"+form_id).val() : 1)); div_paypal_products.html(div_paypal_products.html()+"
"+label+ ' - '+ span_value+"
"); } ); }); jQuery("#form" +form_id+ " div[type='type_paypal_shipping']").each(function() { id=jQuery(this).parent().attr('wdid'); jQuery(this).find('input:checked').each( function() { label= jQuery("label[for='"+jQuery(this).attr('id')+"']").html(); span_value = FormCurrency + jQuery(this).val()+(jQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? ' x'+jQuery('#wdform_'+id+"_element_quantity"+form_id).val() : ''); total_shipping =total_shipping + jQuery(this).val() * parseInt((jQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? jQuery('#wdform_'+id+"_element_quantity"+form_id).val() : 1)); div_paypal_products.html(div_paypal_products.html()+"
"+label+ ' - '+ span_value+"
"); } ); }); jQuery("#form" +form_id+ " div[type='type_paypal_select']").each(function() { id=jQuery(this).parent().attr('wdid'); if(jQuery(this).find('select').val()!='') { label = jQuery(this).find('select option:selected').html(); span_value = FormCurrency + jQuery(this).find('select').val()+(jQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? ' x'+jQuery('#wdform_'+id+"_element_quantity"+form_id).val() : ''); total =total + jQuery(this).find('select').val() * parseInt((jQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? jQuery('#wdform_'+id+"_element_quantity"+form_id).val() : 1)); div_paypal_products.html(div_paypal_products.html()+"
"+label+ ' - '+ span_value+"
"); } }); jQuery("#form" +form_id+ " div[type='type_paypal_price']").each(function() { id=jQuery(this).parent().attr('wdid'); if(jQuery('#wdform_'+id+"_element_dollars"+form_id).hasClass('input_active') || jQuery('#wdform_'+id+"_element_cents"+form_id).hasClass('input_active')) { label= jQuery(this).find('.wdform-label').html(); cents='00'; dollars='0'; if( jQuery('#wdform_'+id+"_element_dollars"+form_id).hasClass('input_active')) { if(jQuery('#wdform_'+id+"_element_dollars"+form_id).val()!='') { dollars=jQuery('#wdform_'+id+"_element_dollars"+form_id).val(); } } if( jQuery('#wdform_'+id+"_element_cents"+form_id).hasClass('input_active') && jQuery('#wdform_'+id+"_element_cents"+form_id).val()!='') { if(jQuery('#wdform_'+id+"_element_cents"+form_id).val().length==1) { cents='0'+jQuery('#wdform_'+id+"_element_cents"+form_id).val(); } else { cents=jQuery('#wdform_'+id+"_element_cents"+form_id).val(); } } span_value = FormCurrency + dollars+'.'+cents; total =total + parseFloat(dollars+'.'+cents); div_paypal_products.html(div_paypal_products.html()+"
"+label+ ' - '+ span_value+"
"); } }); jQuery("#form" +form_id+ " div[type='type_paypal_price_new']").each(function(){ id=jQuery(this).parent().attr('wdid'); if(jQuery('#wdform_'+id+"_element"+form_id).hasClass('input_active')) { label= jQuery(this).find('.wdform-label').html(); dollars='0'; if(jQuery('#wdform_'+id+"_element"+form_id).hasClass('input_active')) { if(jQuery('#wdform_'+id+"_element"+form_id).val()!='') { dollars=jQuery('#wdform_'+id+"_element"+form_id).val(); } } span_value = FormCurrency + dollars; total =total + parseFloat(dollars); div_paypal_products.html(div_paypal_products.html()+"
"+label+ ' - '+ span_value+"
"); } }); var FormPaypalTax = eval("FormPaypalTax_" + form_id); if(FormPaypalTax != 0) { div_paypal_tax.html('Tax: ' + FormCurrency + (((total)*FormPaypalTax) / 100).toFixed(2)); } jQuery('.div_total'+form_id).html(FormCurrency + (parseFloat((total *(1+FormPaypalTax/100)).toFixed(2))+total_shipping).toFixed(2)); input_paypal_total.val(FormCurrency + (parseFloat((total *(1+FormPaypalTax/100)).toFixed(2))+total_shipping).toFixed(2)); } function check_isnum_or_minus(e) { var chCode1 = e.which || e.keyCode; if (chCode1 != 45) { if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) { return false; } } return true; } function sum_grading_values(num,form_id) { var sum = 0; for(var k=0; k<100;k++) { if(document.getElementById(num+'_element'+form_id+'_'+k)) { if(document.getElementById(num+'_element'+form_id+'_'+k).value) { sum = sum+parseInt(document.getElementById(num+'_element'+form_id+'_'+k).value); } } if(document.getElementById(num+'_total_element'+form_id)) { if(sum > document.getElementById(num+'_total_element'+form_id).innerHTML) { document.getElementById(num+'_text_element'+form_id).innerHTML =" "+ WDF_GRADING_TEXT+" " + document.getElementById(num+'_total_element'+form_id).innerHTML; } else { document.getElementById(num+'_text_element'+form_id).innerHTML=""; } } } if(document.getElementById(num+'_sum_element'+form_id)) { document.getElementById(num+'_sum_element'+form_id).innerHTML = sum; } } function change_src(id,el_id,form_id,color) { if(rated==false) { for(var j=0;j<=id;j++) { document.getElementById(el_id+'_star_'+j+'_'+form_id).src=fm_objectL10n.plugin_url+"/images/star_"+color+'.png'; } } } function reset_src(id,el_id, form_id) { if(rated==false) { for(var j=0;j<=id;j++) { document.getElementById(el_id+'_star_'+j+'_'+form_id).src=fm_objectL10n.plugin_url+"/images/star.png"; } } } function select_star_rating(id,el_id,form_id, color,star_amount) { rated=true; for(var j=0;j<=id;j++) { document.getElementById(el_id+'_star_'+j+'_'+form_id).src=fm_objectL10n.plugin_url+"/images/star_"+color+".png"; } for(var k=id+1;k<=star_amount-1;k++) { document.getElementById(el_id+'_star_'+k+'_'+form_id).src=fm_objectL10n.plugin_url+"/images/star.png"; } document.getElementById(el_id+'_selected_star_amount'+form_id).value=id+1; } function show_other_input(num, form_id) { var element_other = jQuery('.form' + form_id + ' [id^=' + num + '_element' + form_id + '][other="1"]'); var parent_ = element_other.parent(); var br = document.createElement('br'); br.setAttribute("id", num + "_other_br" + form_id); var elem_id = num.split("_")[1]; var el_other = document.createElement('input'); el_other.setAttribute("id", num + "_other_input" + form_id); el_other.setAttribute("name", num + "_other_input" + form_id); el_other.setAttribute("type", "text"); el_other.setAttribute("class", "other_input"); el_other.setAttribute("onchange", "other_input_change(this, '" + form_id + "', '" + elem_id + "')"); parent_.append(br); parent_.append(el_other); } function other_input_change(elem, form_id, wdid) { if (jQuery(elem).val() == "") { wd_is_filled(form_id, wdid); } else { jQuery("#form" + form_id + " #wd_required_" + wdid).remove(); jQuery("#form" + form_id + " div[wdid='" + wdid + "'] .wdform-label-section:first .error_label").removeClass("error_label"); } } function check_isnum(e) { var chCode1 = e.which || e.keyCode; if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) { return true; } if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) { return false; } return true; } function captcha_refresh(id,genid) { srcArr=document.getElementById(id+genid).src.split("&r="); document.getElementById(id+genid).src=srcArr[0]+'&r='+Math.floor(Math.random()*100); document.getElementById(id+"_input"+genid).value=''; document.getElementById(id+genid).style.display="inline-block"; } function set_checked(id,j,form_id) { checking=document.getElementById(id+"_element"+form_id+j); if(checking.getAttribute('other')) { if(checking.getAttribute('other')==1) { if(!checking.checked) { if(document.getElementById(id+"_other_input"+form_id)) { document.getElementById(id+"_other_input"+form_id).parentNode.removeChild(document.getElementById(id+"_other_br"+form_id)); document.getElementById(id+"_other_input"+form_id).parentNode.removeChild(document.getElementById(id+"_other_input"+form_id)); } return false; } } } return true; } function set_default(id, j, form_id) { if(document.getElementById(id+"_other_input"+form_id)) { document.getElementById(id+"_other_input"+form_id).parentNode.removeChild(document.getElementById(id+"_other_br"+form_id)); document.getElementById(id+"_other_input"+form_id).parentNode.removeChild(document.getElementById(id+"_other_input"+form_id)); } } function add_0(x) { if(jQuery(x).val().length==1) { jQuery(x).val('0'+jQuery(x).val()); } } function check_hour(e, id, hour_interval) { var chCode1 = e.which || e.keyCode; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) { return false; } hour=""+document.getElementById(id).value+String.fromCharCode(chCode1); hour=parseFloat(hour); if((hour<0) || (hour>hour_interval)) { return false; } return true; } function check_minute(e, id) { var chCode1 = e.which || e.keyCode; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) { return false; } minute=""+document.getElementById(id).value+String.fromCharCode(chCode1); minute=parseFloat(minute); if ((minute<0) || (minute>59)) { return false; } return true; } function check_second(e, id) { var chCode1 = e.which || e.keyCode; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) { return false; } second=""+document.getElementById(id).value+String.fromCharCode(chCode1); second=parseFloat(second); if ((second<0) || (second>59)) { return false; } return true; } function check_isnum_interval(e, x, from, to) { var chCode1 = e.which || e.keyCode; if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) { return true; } if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) { return false; } val1=""+jQuery(x).val()+String.fromCharCode(chCode1); if (val1.length>2) { return false; } if (val1=='00') { return false; } if ((val1to)) { return false; } return true; } function change_year(x) { year=jQuery(x).val(); from=parseFloat(jQuery(x).attr('from')); to=parseFloat(jQuery(x).attr('to')); year=parseFloat(year); if((year>=from) && (year<=to)) { jQuery(x).val(year); } else { jQuery(x).val(''); } } function check_day(e, x) { var chCode1 = e.which || e.keyCode; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) { return false; } day=""+jQuery(x).val()+String.fromCharCode(chCode1); if(day.length>2) { return false; } if(day=='00') { return false; } day=parseFloat(day); if((day<0) || (day>31)) { return false; } return true; } function check_month(e, x) { var chCode1 = e.which || e.keyCode; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) { return false; } month=""+jQuery(x).val()+String.fromCharCode(chCode1); if(month.length>2) { return false; } if(month=='00') { return false; } month=parseFloat(month); if((month<0) || (month>12)) { return false; } return true; } function check_year1(e, x) { var chCode1 = e.which || e.keyCode; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) { return false; } year=""+jQuery(x).val()+String.fromCharCode(chCode1); to=parseFloat(jQuery(x).attr('to')); year=parseFloat(year); if(year>to) { return false; } return true; } function delete_value(x) { ofontStyle=jQuery(x).attr('class'); if(ofontStyle.indexOf("input_deactive")!=-1) { jQuery(x).val("").removeClass("input_deactive").addClass("input_active"); } } function return_value(x) { if(jQuery(x).val()=="") { jQuery(x).val(jQuery(x).attr('title')).removeClass("input_active").addClass("input_deactive"); } } function destroyChildren(node) { while (node.firstChild) { node.removeChild(node.firstChild); } } function generate_page_nav(id, form_id, form_view_count, form_view_max) { form_view=id; page_nav=document.getElementById(form_id+'page_nav'+id); destroyChildren(page_nav); form_view_elemet=document.getElementById(form_id+'form_view'+id); remove_whitespace(form_view_elemet.parentNode.parentNode); display_none_form_views_all(form_id); generate_page_bar(id, form_id, form_view_count, form_view_max); form_view_elemet.parentNode.style.display=""; var td = document.createElement("div"); td.setAttribute("valign", "middle"); td.setAttribute("align", "left"); td.style.display="table-cell"; td.style.width="40%"; page_nav.appendChild(td); if(form_view_elemet.parentNode.previousSibling && form_view_elemet.parentNode.previousSibling.previousSibling) { if(form_view_elemet.parentNode.previousSibling.tagName=="DIV") { table=form_view_elemet.parentNode.previousSibling; } else { if(form_view_elemet.parentNode.previousSibling.previousSibling.tagName=="DIV") { table=form_view_elemet.parentNode.previousSibling.previousSibling; } else { table="none"; } } if(table!="none") { if(!table.firstChild.tagName) { table.removeChild(table.firstChild); } previous_title = form_view_elemet.getAttribute('previous_title'); previous_type = form_view_elemet.getAttribute('previous_type'); if(previous_type=="text") { td.setAttribute("class", "previous-page"); } previous_class = form_view_elemet.getAttribute('previous_class'); previous_checkable = form_view_elemet.getAttribute('previous_checkable'); next_or_previous="previous"; previous=make_pagebreak_button(next_or_previous, previous_title, previous_type, previous_class, previous_checkable, id, form_id, form_view_count, form_view_max); td.appendChild(previous); } } var td = document.createElement("div"); td.setAttribute("id", form_id+"page_numbers"+form_view); td.setAttribute("valign", "middle"); td.setAttribute("class", "page-numbers"); td.setAttribute("align", "center"); td.style.display="table-cell"; if(document.getElementById('fm-pages' + form_id).getAttribute('show_numbers')=="true") { k=0; for(j=1; j<=form_view_max; j++) { if(document.getElementById(form_id+'form_view'+j)) { k++; if(j==form_view) { page_number=k; } } } var cur = document.createElement('span'); cur.setAttribute("class", "page_numbers"); cur.innerHTML=page_number+'/'+k; td.appendChild(cur); } page_nav.appendChild(td); var td = document.createElement("div"); td.setAttribute("valign", "middle"); td.setAttribute("align", "right"); td.style.cssText = "display:table-cell; width:40%; text-align:right;"; page_nav.appendChild(td); not_next=false; if(form_view_elemet.parentNode.nextSibling) { if(form_view_elemet.parentNode.nextSibling.tagName=="DIV" && form_view_elemet.parentNode.nextSibling.className=="wdform-page-and-images") { table=form_view_elemet.parentNode.nextSibling; } else { if(form_view_elemet.parentNode.nextSibling.nextSibling) { if(form_view_elemet.parentNode.nextSibling.nextSibling.tagName=="DIV") { table=form_view_elemet.parentNode.nextSibling.nextSibling; } else { table="none"; } } else { table="none"; } } if(table!="none") { next_title =form_view_elemet.getAttribute('next_title'); next_type =form_view_elemet.getAttribute('next_type'); if(next_type=="text") { td.setAttribute("class", "next-page"); } next_class = form_view_elemet.getAttribute('next_class'); next_checkable = form_view_elemet.getAttribute('next_checkable'); next_or_previous="next"; next=make_pagebreak_button(next_or_previous, next_title, next_type, next_class, next_checkable, id, form_id, form_view_count, form_view_max); td.appendChild(next); } else { not_next=true; } } else { not_next=true; } jQuery("#form" + form_id + " div[type='type_map']").each(function() { id=jQuery(this).parent().attr('wdid'); if_gmap_init('wdform_'+id, form_id); for(q=0; q<20; q++) { if(jQuery("#wdform_"+id+"_element"+form_id)[0].getAttribute("long"+q)) { w_long=parseFloat(document.getElementById('wdform_'+id+"_element"+form_id).getAttribute("long"+q)); w_lat=parseFloat(document.getElementById('wdform_'+id+"_element"+form_id).getAttribute("lat"+q)); w_info=parseFloat(document.getElementById('wdform_'+id+"_element"+form_id).getAttribute("info"+q)); add_marker_on_map('wdform_'+id, q, w_long, w_lat, w_info, form_id,false); } } }); jQuery("#form" + form_id + " div[type='type_mark_map']").each(function() { id=jQuery(this).parent().attr('wdid'); if_gmap_init('wdform_'+id, form_id); q=0; if(jQuery("#wdform_"+id+"_element"+form_id)[0].getAttribute("long"+q)) { w_long=parseFloat(document.getElementById('wdform_'+id+"_element"+form_id).getAttribute("long"+q)); w_lat=parseFloat(document.getElementById('wdform_'+id+"_element"+form_id).getAttribute("lat"+q)); w_info=parseFloat(document.getElementById('wdform_'+id+"_element"+form_id).getAttribute("info"+q)); add_marker_on_map('wdform_'+id, q, w_long, w_lat, w_info, form_id,true); } }); jQuery('.wdform-element-section').each(function() { if(!jQuery(this).parent()[0].style.width && parseInt(jQuery(this).width())!=0) { if(jQuery(this).css('display')=="table-cell") { if(jQuery(this).parent().attr('type')!="type_captcha") { jQuery(this).parent().css('width', parseInt(jQuery(this).width()) + parseInt(jQuery(this).parent().find(jQuery(".wdform-label-section"))[0].style.width)+15); } else { jQuery(this).parent().css('width', (parseInt(jQuery(this).parent().find(jQuery(".captcha_input"))[0].style.width)*2+50) + parseInt(jQuery(this).parent().find(jQuery(".wdform-label-section"))[0].style.width)+15); } } } }); } function display_none_form_views_all(form_id) { for(t=1; t<30; t++) { if(document.getElementById(form_id+'form_view'+t)) { document.getElementById(form_id+'form_view'+t).parentNode.style.display="none"; } } } function generate_page_bar(form_view, form_id, form_view_count, form_view_max) { if(document.getElementById('fm-pages' + form_id).getAttribute('type')=='steps') { make_page_steps_front(form_view, form_id, form_view_count, form_view_max); } else { if(document.getElementById('fm-pages' + form_id).getAttribute('type')=='percentage') { make_page_percentage_front(form_view, form_id, form_view_count, form_view_max); } else { make_page_none_front(form_id); } } if(document.getElementById('fm-pages' + form_id).getAttribute('type')=='show_numbers') { td = document.getElementById(form_id+'page_numbers'+form_view); if(td) { destroyChildren(td); k=0; for(j=1; j<=form_view_max; j++) { if(document.getElementById(form_id+'form_view'+j)) { k++; if(j==form_view) { page_number=k; } } } var cur = document.createElement('span'); cur.setAttribute("class", "page_numbers"); cur.innerHTML=page_number+'/'+k; td.appendChild(cur); } } else { td = document.getElementById(form_id+'page_numbers'+form_view); if(td) { destroyChildren(document.getElementById(form_id+'page_numbers'+form_view)); } } } function make_page_steps_front(form_view, form_id, form_view_count, form_view_max) { destroyChildren(document.getElementById('fm-pages' + form_id)); show_title =(document.getElementById('fm-pages' + form_id).getAttribute('show_title')=='true'); next_checkable =(document.getElementById(form_id+'form_view'+form_view).getAttribute('next_checkable')=='true'); previous_checkable =(document.getElementById(form_id+'form_view'+form_view).getAttribute('previous_checkable')=='true'); k=0; for(j=1; j<=form_view_max; j++) { if(document.getElementById(form_id+'form_view'+j)) { if(document.getElementById(form_id+'form_view'+j).getAttribute('page_title')) { w_pages=document.getElementById(form_id+'form_view'+j).getAttribute('page_title'); } else { w_pages=""; } k++; page_number = document.createElement('span'); page_number.setAttribute('id','page_'+j); if(jform_view) { if(next_checkable) { page_number.setAttribute('onClick','if(check'+form_id+'('+form_view+', '+form_id+')) generate_page_nav("'+j+'", "'+form_id+'", "'+form_view_count+'", "'+form_view_max+'")'); } else { page_number.setAttribute('onClick','generate_page_nav("'+j+'", "'+form_id+'", "'+form_view_count+'", "'+form_view_max+'")'); } } if(j==form_view) { page_number.setAttribute('class',"page_active"); } else { page_number.setAttribute('class',"page_deactive"); } if(show_title) { page_number.innerHTML=w_pages; } else { page_number.innerHTML=k; } document.getElementById('fm-pages' + form_id).appendChild(page_number); } } } function make_page_percentage_front(form_view, form_id, form_view_count, form_view_max) { destroyChildren(document.getElementById('fm-pages' + form_id)); show_title=(document.getElementById('fm-pages' + form_id).getAttribute('show_title')=='true'); var div_parent = document.createElement('div'); div_parent.setAttribute("class", "page_percentage_deactive"); var div = document.createElement('div'); div.setAttribute("id", "div_percentage"); div.setAttribute("class", "page_percentage_active"); div.setAttribute("align", "right"); var div_arrow = document.createElement('div'); div_arrow.setAttribute("class", "wdform_percentage_arrow"); var b = document.createElement('b'); b.setAttribute("class", "wdform_percentage_text"); div.appendChild(b); k=0; cur_page_title=''; for(j=1; j<=form_view_max; j++) { if(document.getElementById(form_id+'form_view'+j)) { if(document.getElementById(form_id+'form_view'+j).getAttribute('page_title')) { w_pages=document.getElementById(form_id+'form_view'+j).getAttribute('page_title'); } else { w_pages=""; } k++; if(j==form_view) { if(show_title) { var cur_page_title = document.createElement('div'); cur_page_title.innerHTML=w_pages; cur_page_title.innerHTML=w_pages; cur_page_title.setAttribute("class", "wdform_percentage_title"); } page_number=k; } } } b.innerHTML=Math.round(((page_number-1)/k)*100)+'%'; div.style.width=((page_number-1)/k)*100+'%'; if(page_number==1) { div_arrow.style.display='none'; } div_parent.appendChild(div); div_parent.appendChild(div_arrow); if(cur_page_title) { div_parent.appendChild(cur_page_title); } document.getElementById('fm-pages' + form_id).appendChild(div_parent); } function make_page_none_front(form_id) { destroyChildren(document.getElementById('fm-pages' + form_id)); } function make_pagebreak_button(next_or_previous,title,type, class_, checkable, id, form_id, form_view_count, form_view_max) { switch(type) { case 'text': { var element = document.createElement('div'); element.setAttribute('id', "page_"+next_or_previous+"_"+id); element.setAttribute('class', class_); if(checkable=="true") { element.setAttribute('onClick', "if(check"+form_id+"("+id+", "+form_id+")) page_"+next_or_previous+"("+id+","+form_id+","+form_view_count+","+form_view_max+")"); } else { element.setAttribute('onClick', "page_"+next_or_previous+"("+id+","+form_id+","+form_view_count+","+form_view_max+")"); } element.innerHTML=title; return element; } case 'img':{ var element = document.createElement('img'); element.setAttribute('id', "page_"+next_or_previous+"_"+id); element.setAttribute('class', class_); if(checkable=="true") { element.setAttribute('onClick', "if(check"+form_id+"("+id+", "+form_id+")) page_"+next_or_previous+"("+id+","+form_id+","+form_view_count+","+form_view_max+")"); } else { element.setAttribute('onClick', "page_"+next_or_previous+"("+id+","+form_id+","+form_view_count+","+form_view_max+")"); } if(title.indexOf("http")==0) { element.src=title; } else { element.src=fm_objectL10n.plugin_url+'/'+title; } return element; } } } function form_maker_findPos(obj) { var curtop = 0; if (obj.offsetParent) { do { curtop += obj.offsetTop; } while (obj = obj.offsetParent); return [curtop]; } } function page_previous(id, form_id, form_view_count, form_view_max) { form_view_elemet = document.getElementById(form_id + 'form_view' + id); if (form_view_elemet.parentNode.previousSibling && form_view_elemet.parentNode.previousSibling.previousSibling) { if (form_view_elemet.parentNode.previousSibling.tagName == "DIV") { table = form_view_elemet.parentNode.previousSibling; } else { table = form_view_elemet.parentNode.previousSibling.previousSibling; } } if (!table.firstChild.tagName) { table.removeChild(table.firstChild); } generate_page_nav(table.firstChild.id.replace(form_id + 'form_view', ""), form_id, form_view_count, form_view_max); form = jQuery("#form" + form_id); if (!form.parent().hasClass('fm-scrollbox-form')) { window.scroll(0, form_maker_findPos(form)); } } function page_next(id, form_id, form_view_count, form_view_max) { form_view_elemet = document.getElementById(form_id + 'form_view' + id); if (form_view_elemet.parentNode.nextSibling) { if (form_view_elemet.parentNode.nextSibling.tagName == "DIV") { table = form_view_elemet.parentNode.nextSibling; } else { table = form_view_elemet.parentNode.nextSibling.nextSibling; } } if (!table.firstChild.tagName) { table.removeChild(table.firstChild); } generate_page_nav(table.firstChild.id.replace(form_id + 'form_view', ""), form_id, form_view_count, form_view_max); form = jQuery("#form" + form_id); if (!form.parent().hasClass('fm-scrollbox-form')) { window.scroll(0, form_maker_findPos(form)); } } function getfileextension(filename, exten) { if(filename.length == 0) { return true; } var dot = filename.lastIndexOf("."); var extension = filename.substr(dot+1,filename.length); exten=exten.split(','); for(var j=0 ; j'); var sel_options = ''; var selected_option = false; jQuery(select).children('option').each(function() { if(jQuery(this).is(':selected')){ selected_option = jQuery(this).index(); } sel_options = sel_options + '
' + jQuery(this).html() + '
'; }); w=jQuery(select)[0].style.width; if(w=='100%') { w='100%'; } else { w=(jQuery(select).width()+32)+'px'; } var sel_imul = '
\
\
' + jQuery(select).children('option').eq(selected_option).html() + '
\
\
\
' + sel_options + '
\
'; jQuery(select).addClass('no-width'); jQuery(select).before(sel_imul); } jQuery(document).on('change','.wdform-element-section select', function() { var tektext = jQuery(this).children("option:selected").text(); jQuery(this).parent('.sel-wrap ').children('.sel-imul').children('.sel-selected').children('.selected-text').html(tektext); jQuery(this).parent('.sel-wrap ').children('.sel-imul').children('.sel-options').children('.sel-option').removeClass('sel-ed'); jQuery(this).addClass('sel-ed'); jQuery(this).parent('.sel-wrap ').children('.sel-imul').children('.sel-options').each(function() { if (jQuery(this).html() == tektext) { jQuery(this).addClass('sel-ed'); } }); }); jQuery(document).on('click','.sel-imul', function() { jQuery('.sel-imul').removeClass('act'); jQuery(this).addClass('act'); if (jQuery(this).children('.sel-options').is(':visible')) { jQuery('.sel-options').hide(); } else { jQuery('.sel-options').hide(); jQuery(this).children('.sel-options').show(); jQuery(this).children('.sel-options').css('width',jQuery(this).width()); } }); jQuery(document).on('click','.sel-option', function() { var tektext = jQuery(this).html(); jQuery(this).parent('.sel-options').parent('.sel-imul').children('.sel-selected').children('.selected-text').html(tektext); jQuery(this).parent('.sel-options').children('.sel-option').removeClass('sel-ed'); jQuery(this).addClass('sel-ed'); var tekval = jQuery(this).attr('value'); tekval = typeof(tekval) != 'undefined' ? tekval : tektext; jQuery(this).parent('.sel-options').parent('.sel-imul').parent('.sel-wrap').children('select').children('option').removeAttr('selected').each(function() { if (jQuery(this).html() == tektext) { jQuery(this).attr('selected', 'select'); } }); jQuery(this).parent('.sel-options').parent('.sel-imul').parent('.sel-wrap').children('select').change(); }); var selenter = false; jQuery(document).on('mouseenter','.sel-imul', function() { selenter = true; }); jQuery(document).on('mouseleave','.sel-imul', function() { selenter = false; }); jQuery(document).click(function() { if (!selenter) { jQuery('.sel-options').hide(); jQuery('.sel-imul').removeClass('act'); } }); function remove_whitespace(node) { var ttt; for (ttt=0; ttt < node.childNodes.length; ttt++) { if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue )) { node.removeChild(node.childNodes[ttt]); ttt--; } else { if(node.childNodes[ttt].childNodes.length) { remove_whitespace(node.childNodes[ttt]); } } } return; } function change_value_range(id, min_max, element_value, default_min_max, format) { if(element_value) { jQuery("#"+id).datepicker('option', min_max, element_value); } else { if(default_min_max == "today") { jQuery("#"+id).datepicker('option', min_max, new Date()); } else { if (default_min_max.indexOf("d") == -1 && default_min_max.indexOf("m") == -1 && default_min_max.indexOf("y") == -1 && default_min_max.indexOf("w") == -1 && default_min_max != "") { default_min_max = jQuery.datepicker.formatDate(format, new Date(default_min_max)); } jQuery("#"+id).datepicker('option', min_max, default_min_max); } } } function wd_check_confirmation_email(wdid, form_id, message, type) { var element = jQuery("#wdform_" + wdid +"_element" + form_id); var element_confirm = jQuery("#wdform_" + wdid +"_1_element" + form_id); var condition_confirm_email = false; if(!window["check_before_submit" + form_id][wdid + "_" + form_id]) { condition_confirm_email = true; } else { condition_confirm_email = jQuery(element).val() != jQuery(element_confirm).val() ? true : false; } if(condition_confirm_email) { jQuery("#confirm_" + wdid + "_" + form_id).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:eq( 1 ) .error_label_confirm").removeClass("error_label_confirm"); if(jQuery(element).val() != jQuery(element_confirm).val()) { jQuery(element_confirm).parent().append("
" + message + "
"); jQuery("#form"+form_id+ " div[wdid='"+wdid+"'] .wdform-label-section:eq( 1 ) .wdform-label").addClass("error_label_confirm"); } window["check_before_submit" + form_id][wdid + "_" + form_id] = (wdid + "_" + form_id in window["check_before_submit" + form_id]) ? window["check_before_submit" + form_id][wdid + "_" + form_id] : true; } else { jQuery("#confirm_" + wdid + "_" + form_id).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:eq( 1 ) .error_label_confirm").removeClass("error_label_confirm"); if(window["check_before_submit" + form_id][wdid + "_" + form_id] == true) { delete window["check_before_submit" + form_id][wdid + "_" + form_id]; } } } function wd_check_email(wdid, form_id, message_check) { var element = jQuery("#wdform_" + wdid +"_element" + form_id); var element_confirm = jQuery("#wdform_" + wdid +"_1_element" + form_id); if(jQuery(element).val()!="" && jQuery.trim(jQuery(element).val()).search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1 && jQuery(element).attr("title") != jQuery(element).val()){ jQuery("#check_email_" + wdid + "_" + form_id).remove(); jQuery(element).parent().append("
" + message_check + "
"); jQuery("#form"+form_id+ " div[wdid='"+wdid+"'] .wdform-label-section:first .wdform-label").addClass("error_label_check_mail"); if(element.val() == element_confirm.val()) { jQuery("#confirm_" + wdid + "_" + form_id).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:eq( 1 ) .error_label_confirm").removeClass("error_label_confirm"); } delete window["check_before_submit" + form_id][wdid + "_" + form_id]; window["check_before_submit" + form_id][wdid + "_" + form_id] = false; } else { jQuery("#check_email_" + wdid + "_" + form_id).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label_check_mail").removeClass("error_label_check_mail"); window["check_before_submit" + form_id][wdid + "_" + form_id] = true; if(typeof element_confirm.val() ==="undefined") { delete window["check_before_submit" + form_id][wdid + "_" + form_id]; } } } function wd_check_confirmation_pass(wdid, form_id, message) { var element = jQuery("#wdform_" + wdid +"_element" + form_id); var element_confirm = jQuery("#wdform_" + wdid +"_1_element" + form_id); var condition_confirm_pass = false; condition_confirm_pass = element.val() !== element_confirm.val(); if(condition_confirm_pass) { jQuery("#confirm_" + wdid + "_" + form_id).remove(); jQuery(element_confirm).parent().append("
" + message + "
"); jQuery("#form"+form_id+ " div[wdid='"+wdid+"'] .wdform-label-section:eq( 1 ) .wdform-label").addClass("error_label_check_pass"); window["check_before_submit" + form_id][wdid + "_" + form_id] = false; } else { jQuery("#confirm_" + wdid + "_" + form_id).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:eq( 1 ) .error_label_check_pass").removeClass("error_label_check_pass"); delete window["check_before_submit" + form_id][wdid + "_" + form_id]; } } function minimize_form(form_id) { jQuery("#fm-scrollbox"+form_id).removeClass("fm-animated fadeInUp").addClass("fm-animated fadeOutDown fm-minimized"); jQuery("#fm-minimize-text"+form_id).removeClass("fm-animated fadeOutDown").addClass("fm-show fm-animated fadeInUp"); } function fm_show_scrollbox(form_id) { jQuery("#fm-minimize-text"+form_id).removeClass("fm-animated fadeInUp").addClass("fm-animated fadeOutDown"); jQuery("#fm-scrollbox"+form_id).removeClass("fm-animated fadeOutDown fm-minimized").addClass("fm-show fm-animated fadeInUp"); } function fm_hide_form(form_id, hide_interval, close_callback) { var hide_date = new Date(); hide_date.setDate(hide_date.getDate() + hide_interval); if( hide_interval > 0 ) { localStorage.setItem('hide-'+form_id, hide_date.getTime()); } if(typeof close_callback === 'function') { close_callback(); } } function wd_check_regExp(form_id, regExpObj) { var x = jQuery("#form" + form_id); var find_wrong_exp = false; var check_regExp = regExpObj ? regExpObj : window['check_regExp_all'+form_id]; jQuery.each( check_regExp, function( wdid, exp ) { var element = "#wdform_" + wdid + "_element" + form_id; var RegExpression = ""; var rules = unescape(exp[0]); (exp[1].length <= 0) ? RegExpression = new RegExp(rules) : RegExpression = new RegExp(rules, exp[1]); if(x.find(jQuery("div[wdid='"+wdid+"']")).length != 0 && x.find(jQuery("div[wdid='"+wdid+"']")).css("display") != "none") { if(jQuery(element).val().length > 0 && jQuery(element).val() != jQuery(element).attr('title')) { if (RegExpression.test(jQuery(element).val()) != true) { jQuery("#form"+form_id+" #wd_exp_"+wdid).remove(); x.find(jQuery("div[wdid='"+wdid+"'] .wdform-element-section")).append("
" + exp[2] + "
"); jQuery("#form"+form_id+ " div[wdid='"+wdid+"'] .wdform-label-section:first .wdform-label").addClass("error_label_exp"); find_wrong_exp = true; if(!regExpObj){ scroll_on_element(form_id); } } } } }); if(find_wrong_exp === false) { return true; } return false; } function scroll_on_element(form_id) { var parent_div = jQuery("#form" + form_id + " .fm-not-filled")[0].closest(".wdform_row"); var body_hight = document.body.clientHeight; var element_offset = jQuery(jQuery("#form" + form_id + " .fm-not-filled")[0]).offset().top; var scrollChecker = function() { if(document.body.clientHeight !== body_hight ) { body_hight = document.body.clientHeight; element_offset = jQuery(jQuery("#form" + form_id + " .fm-not-filled")[0]).offset().top; jQuery('html body').stop(); animateBodyToError(); } }; jQuery(window).on("scroll",scrollChecker); function animateBodyToError() { jQuery('html body').animate({ scrollTop: element_offset - 150 }, 500, function() { jQuery(window).off("scroll", scrollChecker); old_bg=jQuery(parent_div).css("background-color"); jQuery(parent_div).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false }); }); } animateBodyToError(); } function wd_file_upload_check(form_id, upload_check_field){ var x = jQuery("#form" + form_id); var find_wrong_type_upload = false; var upload_check = upload_check_field ? upload_check_field : window['file_upload_check'+form_id]; jQuery.each( upload_check, function( wdid, upload_types ) { var element = "#wdform_" + wdid + "_element" + form_id; if(x.find(jQuery("div[wdid='"+wdid+"']")).length != 0 && x.find(jQuery("div[wdid='"+wdid+"']")).css("display") != "none") { ext_available=getfileextension(jQuery(element).val(), upload_types); if(!ext_available) { jQuery("#form"+form_id+" #wd_upload_type_"+wdid).remove(); x.find(jQuery("div[wdid='"+wdid+"'] .wdform-element-section")).append("
" + fm_objectL10n.fm_file_type_error + "
"); jQuery("#form"+form_id+ " div[wdid='"+wdid+"'] .wdform-label-section:first .wdform-label").addClass("error_label_upload"); find_wrong_type_upload = true; } else { jQuery("#form"+form_id+" #wd_upload_type_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label_upload").removeClass("error_label_upload") } } }); if(!upload_check_field && find_wrong_type_upload === true){ scroll_on_element(form_id); } if(find_wrong_type_upload === false) { return true; } return false; } function wd_is_filled(form_id, field_id) { var x = jQuery("#form" + form_id); var req_fields = field_id ? field_id.split() : window['required_fields'+form_id]; var not_filled = {}; jQuery(req_fields).each(function(index, wdid) { if(x.find(jQuery("div[wdid='"+wdid+"']")).length != 0 && x.find(jQuery("div[wdid='"+wdid+"']")).css("display") != "none" ) { switch(window['labels_and_ids'+form_id][wdid]) { case 'type_text': case 'type_textarea': case 'type_paypal_price_new': case 'type_spinner': case 'type_number': case 'type_phone_new': case 'type_submitter_mail': { var element = "#wdform_" + wdid + "_element" + form_id; if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(element).val() == jQuery(element).attr('title') || jQuery(element).val() == ""){ not_filled[wdid] = element; } } if(!field_id && !window['check_submit'+form_id]) { jQuery(element).focus(function() { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); }).blur(function() { wd_is_filled(form_id, wdid); }); } break; } case 'type_own_select': case 'type_country': case 'type_paypal_select': { var element = "#wdform_" + wdid + "_element" + form_id; if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(element).val() == "") { not_filled[wdid] = element; } } if(!field_id && !window['check_submit'+form_id]) { jQuery(element).focus(function() { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); }).blur(function() { wd_is_filled(form_id, wdid); }).change(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); wd_is_filled(form_id, wdid); }); } break; } case 'type_phone': { var element = ["#wdform_" + wdid + "_element_first" + form_id, "#wdform_" + wdid + "_element_last" + form_id]; jQuery.each(element, function(i, elem){ if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(elem).val() == "" || jQuery(elem).val() == jQuery(elem).attr('title')){ not_filled[wdid] = elem; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(elem).focus(function() { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); }).blur(function() { wd_is_filled(form_id, wdid); }); } }); break; } case 'type_name': { var element = ["#wdform_" + wdid + "_element_title" + form_id, "#wdform_" + wdid + "_element_first" + form_id, "#wdform_" + wdid + "_element_last" + form_id, "#wdform_" + wdid + "_element_middle" + form_id]; jQuery.each(element, function(i, elem){ if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if((jQuery(elem).val() == "" || jQuery(elem).val() == jQuery(elem).attr('title')) && typeof jQuery(elem).val() != "undefined"){ not_filled[wdid] = elem; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(elem).focus(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); }).blur(function() { wd_is_filled(form_id, wdid); }); } }); break; } case 'type_address': { var element = ["#wdform_" + wdid + "_street1" + form_id, "#wdform_" + wdid + "_street2" + form_id, "#wdform_" + wdid + "_city" + form_id, "#wdform_" + wdid + "_state" + form_id, "#wdform_" + wdid + "_postal" + form_id, "#wdform_" + wdid + "_country" + form_id]; jQuery.each(element, function(i, elem){ if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(elem).val() == "" && typeof jQuery(elem).val() != "undefined"){ not_filled[wdid] = elem; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(elem).focus(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); }).blur(function() { wd_is_filled(form_id, wdid); }); } }); break; } case 'type_checkbox': case 'type_radio': case 'type_scale_rating': case 'type_paypal_checkbox': case 'type_paypal_radio': case 'type_paypal_shipping': { if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none"){ if(x.find(jQuery("div[wdid='"+ wdid +"'] input:checked")).length == 0 || jQuery("#wdform_"+ wdid +"_other_input" + form_id).val() == ""){ not_filled[wdid] = true; } } if(!field_id && !window['check_submit'+form_id]){ jQuery.each(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input"), function( i, val ){ jQuery(this).change(function() { if(x.find(jQuery("div[wdid='"+ wdid +"'] input:checked")).length == 0 || jQuery("#wdform_"+ wdid +"_other_input" + form_id).val() == ""){ wd_is_filled(form_id, wdid); } else{ jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); } }); }); } break; } case 'type_star_rating': { var element = "#wdform_" + wdid + "_selected_star_amount" + form_id; if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(element).val() == ""){ not_filled[wdid] = true; } } if(!field_id && !window['check_submit'+form_id]){ jQuery("#wdform_" + wdid + "_element" + form_id).click(function(){ if(jQuery(element).val() != ""){ jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); } }); } break; } case 'type_range': { var element = ["#wdform_" + wdid + "_element" + form_id + "0", "#wdform_" + wdid + "_element" + form_id + "1"]; jQuery.each(element, function(i, elem){ if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(elem).val() == ""){ not_filled[wdid] = elem; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(elem).focus(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); }).blur(function() { wd_is_filled(form_id, wdid); }); } }); break; } case 'type_grading': { if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { var count_grading = 0; jQuery.each(jQuery("#wdform_" + wdid + "_element" + form_id + " input"), function( i, val ){ if(jQuery(this).val() != "") count_grading ++; }); if(count_grading == 0) not_filled[wdid] = true; } if(!field_id && !window['check_submit'+form_id]){ jQuery.each(jQuery("#wdform_" + wdid + "_element" + form_id + " input"), function( i, val ){ jQuery(this).focus(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); }).blur(function() { wd_is_filled(form_id, wdid); }); }); } break; } case 'type_slider': { var slider_element = "#wdform_" + wdid + "_element" + form_id; var element = "#wdform_" + wdid + "_slider_value" + form_id; var min_value = "#wdform_" + wdid + "_element_min" + form_id; if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(element).val() == jQuery(min_value).html()){ not_filled[wdid] = true; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(slider_element).slider({ change: function( event, ui ) { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); wd_is_filled(form_id, wdid); } }); } break; } case 'type_date': case 'type_date_new': { var element = "#wdform_" + wdid + "_element" + form_id; if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(element).val() == ""){ not_filled[wdid] = element; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(element).focus(function() { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); }).change(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); wd_is_filled(form_id, wdid); }); } break; } case 'type_date_range': { var element = ["#wdform_" + wdid + "_element" + form_id + "0", "#wdform_" + wdid + "_element" + form_id + "1"]; jQuery.each(element, function(i, elem){ if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(elem).val() == ""){ not_filled[wdid] = elem; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(elem).focus(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); }).change(function() { wd_is_filled(form_id, wdid); }); } }); break; } case 'type_date_fields': { var element = ["#wdform_" + wdid + "_day" + form_id, "#wdform_" + wdid + "_month" + form_id, "#wdform_" + wdid + "_year" + form_id]; jQuery.each(element, function(i, elem) { if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(elem).val() == ""){ not_filled[wdid] = elem; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(elem).focus(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); }).blur(function() { wd_is_filled(form_id, wdid); }).change(function() { wd_is_filled(form_id, wdid); }); } }); break; } case 'type_time': { var element = ["#wdform_" + wdid + "_hh" + form_id, "#wdform_" + wdid + "_mm" + form_id, "#wdform_" + wdid + "_ss" + form_id]; jQuery.each(element, function(i, elem){ if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(elem).val() == "" && typeof jQuery(elem).val() != "undefined"){ not_filled[wdid] = elem; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(elem).focus(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); }).blur(function() { wd_is_filled(form_id, wdid); }); } }); break; } case 'type_password': { var element = "#wdform_" + wdid + "_element" + form_id; if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(element).val() == ""){ not_filled[wdid] = element; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(element).focus(function() { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); }).blur(function() { wd_is_filled(form_id, wdid); }); } break; } case 'type_file_upload': { var element = "#wdform_" + wdid + "_element" + form_id; if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(element).val() == jQuery(element).attr('title') || jQuery(element).val() == ""){ not_filled[wdid] = element; } } if(!field_id && !window['check_submit'+form_id]) { jQuery(element).focus(function() { jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); }).change(function() { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); wd_is_filled(form_id, wdid); }); } break; } case 'type_matrix': { if(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input").attr('type') =="radio" || jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input").attr('type') =="checkbox"){ if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(x.find(jQuery("div[wdid='"+ wdid +"'] input:checked")).length == 0){ not_filled[wdid] = true; } } if(!field_id && !window['check_submit'+form_id]) { jQuery.each(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input"), function( i, val ){ jQuery(this).change(function() { if(x.find(jQuery("div[wdid='"+ wdid +"'] input:checked")).length == 0){ wd_is_filled(form_id, wdid); } else{ jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); } }); }); } } else if(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input").attr('type') =="text") { if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { var count_input_matrix = 0; jQuery.each(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input"), function( i, val ){ if(jQuery(this).val() != "") count_input_matrix ++; }); if(count_input_matrix == 0) not_filled[wdid] = true; } if(!field_id && !window['check_submit'+form_id]){ jQuery.each(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input"), function( i, val ){ jQuery(this) .focus(function() { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); }) .blur(function() { wd_is_filled(form_id, wdid); }); }); } } else { if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { var count_select_matrix = 0; jQuery.each(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] select"), function( i, val ){ if(jQuery(this).val() != "") count_select_matrix ++; }); if(count_select_matrix == 0) not_filled[wdid] = true; } if(!field_id && !window['check_submit'+form_id]){ jQuery.each(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] select"), function( i, val ){ jQuery(this).focus(function() { if(jQuery(this).val() == ""){ jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); } }).change(function() { wd_is_filled(form_id, wdid); }).blur(function() { wd_is_filled(form_id, wdid); }); }); } } break; } case 'type_send_copy': { if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery("div[wdid='"+ wdid +"'] input:checked").length == 0){ not_filled[wdid] = true; } } if(!field_id && !window['check_submit'+form_id]){ jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input").change(function() { if(jQuery("div[wdid='"+ wdid +"'] input:checked").length == 0){ wd_is_filled(form_id, wdid); } else { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); } }); } break; } case 'type_captcha': case 'type_arithmetic_captcha': { var element = ""; if(window['labels_and_ids'+form_id][wdid] == 'type_captcha') { element = '#wd_captcha_input' + form_id; } else { element = '#wd_arithmetic_captcha_input' + form_id; } if(x.find(jQuery("div[wdid='"+wdid+"']")).closest(".wdform-page-and-images").css('display') !="none") { if(jQuery(element).val() == ""){ not_filled[wdid] = element; } } if(!field_id && !window['check_submit'+form_id]){ jQuery(element).focus(function() { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+" div[wdid='"+wdid+"'] .wdform-label-section:first .error_label").removeClass("error_label"); }).blur(function() { wd_is_filled(form_id, wdid); }); } break; } } } }); if(Object.keys(not_filled).length === 0 && Object.keys(window["check_before_submit" + form_id]).length === 0) { return true; } else { if(Object.keys(not_filled).length !== 0){ jQuery.each( not_filled, function( wdid, elem ) { jQuery("#form"+form_id+" #wd_required_"+wdid).remove(); jQuery("#form"+form_id+ " div[wdid='"+wdid+"'] .wdform-element-section:first").append("
" + fm_objectL10n.fm_field_is_required + "
"); jQuery("#form"+form_id+ " div[wdid='"+wdid+"'] .wdform-label-section:first .wdform-label").addClass("error_label"); }); } if(!field_id){ scroll_on_element(form_id); } window['check_submit'+form_id] = 1; return false; } } function wd_check_price_min_max(form_id, price_nim_max) { var x = jQuery("#form" + form_id); var check_price_min_max = price_nim_max ? price_nim_max : window['check_paypal_price_min_max'+form_id]; var find_wrong_price = false; jQuery.each( check_price_min_max, function( wdid, min_max_option ) { var element = "#wdform_" + wdid + "_element" + form_id; var range_min = min_max_option[3] ? min_max_option[3] : 0; var range_max = min_max_option[4] ? min_max_option[4] : -1; if((min_max_option[2] ? true : false) || jQuery(element).val()!=min_max_option[1]) { if((range_max!=-1 && parseFloat(jQuery(element).val()) > range_max) || parseFloat(jQuery(element).val()) < range_min) { jQuery("#form"+form_id+" #wd_price_"+wdid).remove(); x.find(jQuery("div[wdid='"+wdid+"'] .wdform-element-section")).append("
" + fm_objectL10n.fm_min_max_check_1 + min_max_option[0] + fm_objectL10n.fm_min_max_check_2 + (min_max_option[3] ? min_max_option[3] : 0) + '-' + (min_max_option[4] ? min_max_option[4] : "any") + "
"); jQuery("#form"+form_id+ " div[wdid='"+wdid+"'] .wdform-label-section:first .wdform-label").addClass("error_label_price"); find_wrong_price = true; if(!price_nim_max) { scroll_on_element(form_id); } } } }); if(find_wrong_price === false) { return true; } return false; } function wd_spinner_check(form_id, spinner_check_field) { var x = jQuery("#form" + form_id); var find_wrong_values = false; var spinner_check = spinner_check_field ? spinner_check_field : window['spinner_check'+form_id]; jQuery.each( spinner_check, function( wdid, spinner_values ) { var element = "#wdform_" + wdid + "_element" + form_id; if(x.find(jQuery("div[wdid='"+wdid+"']")).length != 0 && x.find(jQuery("div[wdid='"+wdid+"']")).css("display") != "none") { if(parseInt(jQuery(element).val()) < parseInt(spinner_values[0]) || parseInt(jQuery(element).val()) > parseInt(spinner_values[1])) { jQuery("#form"+form_id+" #wd_price_"+wdid).remove(); x.find(jQuery("div[wdid='"+wdid+"'] .wdform-element-section")).append("
" + fm_objectL10n.fm_spinner_check + (spinner_values[0] ? spinner_values[0] : 0) + '-' + (spinner_values[1] ? spinner_values[1] : "any") + "
"); jQuery("#form"+form_id+ " div[wdid='"+wdid+"'] .wdform-label-section:first .wdform-label").addClass("error_label_price"); find_wrong_values = true; if(!spinner_check_field) { scroll_on_element(form_id); } } } }); if(find_wrong_values === false) { return true; } return false; }; // source --> https://www.omicroner-garagen.de/wp-content/plugins/magic-liquidizer-responsive-table/idjs/ml.responsive.table.min.js?ver=2.0.0 /* * Plugin Name: Magic Liquidizer Responsive Table * Plugin URI: http://www.innovedesigns.com/wordpress/magic-liquidizer-responsive-table-rwd-you-must-have-wp-plugin/ * Author: Elvin Deza * Description: A simple and lightweight plugin that converts HTML table into responsive. After activation, go to Dashboard > Magic Liquidizer Lite > Table. * Version: 2.0.0 * Author URI: http://innovedesigns.com/author/esstat17 */ (function($){$.fn.responsiveTable=function(options){var settings=$.extend({headerSelector:'thead td, thead th, tr th',bodyRowSelector:'tbody tr, tr',rowElement:'
',columnTitleElement:'
',columnValueElement:'
',enable:!0},options);var tableHTML='',display='',titles=new Array(),index=0,jSum=0,row='',dt='',dd='';return this.each(function(o,e){tableHTML=$(this);display=$('
');tableHTML.find(settings.headerSelector).each(function(i,e){titles[i]=$(e).html()});tableHTML.find(settings.bodyRowSelector).each(function(){$(this).children('td').each(function(j){jSum=jSum+j})});tableHTML.find(settings.bodyRowSelector).each(function(i,e){row=$(settings.rowElement);row.addClass('ml-grid ml-clearfix ml-row-'+i);$(this).children('td').each(function(j,d){index=jSum==0?i:j,dt=$(settings.columnTitleElement),dd=$(settings.columnValueElement);dt.addClass('ml-title ml-table');dt.html(titles[index]);dd.addClass('ml-value ml-table');dd.html($(this).html());if($.trim($(this).html())==''){dd.addClass('ml-empty');dt.addClass('ml-empty')} row.append(dt).append(dd)});display.append(row)});if(settings.enable){tableHTML.hide();tableHTML.after(display)}else{$(".ml-responsive-table").remove();tableHTML.show()}})}})(jQuery);(function($){$.fn.MagicLiquidizerTable=function(options){var settings=$.extend({table:'1',breakpoint:'720',whichelement:'table',},options);return this.each(function(){function responsiveTableFn(){var viewwidth=$(window).width();if(viewwidth0){$('html').addClass('rwd-table')} if(settings.table=='1'&&!$('.ml-responsive-table').length>0){$(settings.whichelement).responsiveTable({enable:!0})}}else{if($('html.rwd-table').length>0){$('html').removeClass('rwd-table')} if(settings.table=='1'){$(settings.whichelement).responsiveTable({enable:!1})}}} $(window).resize(responsiveTableFn).ready(responsiveTableFn)})}}(jQuery)); // source --> https://www.omicroner-garagen.de/wp-content/plugins/prettyphoto/js/jquery.prettyPhoto.js?ver=4.9.8 /* ------------------------------------------------------------------------ Class: prettyPhoto Use: Lightbox clone for jQuery Author: Stephane Caron (http://www.no-margin-for-errors.com) Version: 3.1.6 ------------------------------------------------------------------------- */ (function($) { $.prettyPhoto = {version: '3.1.6'}; $.fn.prettyPhoto = function(pp_settings) { pp_settings = jQuery.extend({ hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */ animation_speed: 'fast', /* fast/slow/normal */ ajaxcallback: function() {}, slideshow: 5000, /* false OR interval time in ms */ autoplay_slideshow: false, /* true/false */ opacity: 0.80, /* Value between 0 and 1 */ show_title: true, /* true/false */ allow_resize: true, /* Resize the photos bigger than viewport. true/false */ allow_expand: true, /* Allow the user to expand a resized image. true/false */ default_width: 500, default_height: 344, counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */ horizontal_padding: 20, /* The padding on each side of the picture */ hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */ wmode: 'opaque', /* Set the flash wmode attribute */ autoplay: true, /* Automatically start videos: True/False */ modal: false, /* If set to true, only the close button will close the window */ deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */ overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */ overlay_gallery_max: 30, /* Maximum number of pictures in the overlay gallery */ keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */ changepicturecallback: function(){}, /* Called everytime an item is shown/changed */ callback: function(){}, /* Called when prettyPhoto is closed */ ie6_fallback: true, markup: '
\
 
\
\
\
\
\
\
\
\
\
\
\
\ Expand \
\ next \ previous \
\
\
\
\ Previous \

0/0

\ Next \
\

\
{pp_social}
\ Close \
\
\
\
\
\
\
\
\
\
\
\
\
', gallery_markup: '', image_markup: '', flash_markup: '', quicktime_markup: '', iframe_markup: '', inline_markup: '
{content}
', custom_markup: '', social_tools: '' /* html or false to disable */ }, pp_settings); // Global variables accessible only by prettyPhoto var matchedObjects = this, percentBased = false, pp_dimensions, pp_open, // prettyPhoto container specific pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth, // Window size windowHeight = $(window).height(), windowWidth = $(window).width(), // Global elements pp_slideshow; doresize = true, scroll_pos = _get_scroll(); // Window/Keyboard events $(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); }); if(pp_settings.keyboard_shortcuts) { $(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){ if(typeof $pp_pic_holder != 'undefined'){ if($pp_pic_holder.is(':visible')){ switch(e.keyCode){ case 37: $.prettyPhoto.changePage('previous'); e.preventDefault(); break; case 39: $.prettyPhoto.changePage('next'); e.preventDefault(); break; case 27: if(!settings.modal) $.prettyPhoto.close(); e.preventDefault(); break; }; // return false; }; }; }); }; /** * Initialize prettyPhoto. */ $.prettyPhoto.initialize = function() { settings = pp_settings; if(settings.theme == 'pp_default') settings.horizontal_padding = 16; // Find out if the picture is part of a set theRel = $(this).attr(settings.hook); galleryRegExp = /\[(?:.*)\]/; isSet = (galleryRegExp.exec(theRel)) ? true : false; // Put the SRCs, TITLEs, ALTs into an array. pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href')); pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt')); pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(this).attr('title')); if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false; set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this)); _build_overlay(this); // Build the overlay {this} being the caller if(settings.allow_resize) $(window).bind('scroll.prettyphoto',function(){ _center_overlay(); }); $.prettyPhoto.open(); return false; } /** * Opens the prettyPhoto modal box. * @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths. * @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles. * @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions. */ $.prettyPhoto.open = function(event) { if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables settings = pp_settings; pp_images = $.makeArray(arguments[0]); pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray(""); pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray(""); isSet = (pp_images.length > 1) ? true : false; set_position = (arguments[3])? arguments[3]: 0; _build_overlay(event.target); // Build the overlay {this} being the caller } if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash _checkPosition($(pp_images).size()); // Hide the next/previous links if on first or last images. $('.pp_loaderIcon').show(); if(settings.deeplinking) setHashtag(); // Rebuild Facebook Like Button with updated href if(settings.social_tools){ facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href)); $pp_pic_holder.find('.pp_social').html(facebook_like_link); } // Fade the content in if($ppt.is(':hidden')) $ppt.css('opacity',0).show(); $pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity); // Display the current position $pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).size()); // Set the description if(typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != ""){ $pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position])); }else{ $pp_pic_holder.find('.pp_description').hide(); } // Get the dimensions movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString(); movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString(); // If the size is % based, calculate according to window dimensions percentBased=false; if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; } if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; } // Fade the holder $pp_pic_holder.fadeIn(function(){ // Set the title (settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html(' '); imgPreloader = ""; skipInjection = false; // Inject the proper content switch(_getFileType(pp_images[set_position])){ case 'image': imgPreloader = new Image(); // Preload the neighbour images nextImage = new Image(); if(isSet && set_position < $(pp_images).size() -1) nextImage.src = pp_images[set_position + 1]; prevImage = new Image(); if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1]; $pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]); imgPreloader.onload = function(){ // Fit item to viewport pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height); _showContent(); }; imgPreloader.onerror = function(){ alert('Image cannot be loaded. Make sure the path is correct and image exist.'); $.prettyPhoto.close(); }; imgPreloader.src = pp_images[set_position]; break; case 'youtube': pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport // Regular youtube link movie_id = getParam('v',pp_images[set_position]); // youtu.be link if(movie_id == ""){ movie_id = pp_images[set_position].split('youtu.be/'); movie_id = movie_id[1]; if(movie_id.indexOf('?') > 0) movie_id = movie_id.substr(0,movie_id.indexOf('?')); // Strip anything after the ? if(movie_id.indexOf('&') > 0) movie_id = movie_id.substr(0,movie_id.indexOf('&')); // Strip anything after the & } movie = 'http://www.youtube.com/embed/'+movie_id; (getParam('rel',pp_images[set_position])) ? movie+="?rel="+getParam('rel',pp_images[set_position]) : movie+="?rel=1"; if(settings.autoplay) movie += "&autoplay=1"; toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie); break; case 'vimeo': pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport movie_id = pp_images[set_position]; var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/; var match = movie_id.match(regExp); movie = 'http://player.vimeo.com/video/'+ match[3] +'?title=0&byline=0&portrait=0'; if(settings.autoplay) movie += "&autoplay=1;"; vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width']; toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie); break; case 'quicktime': pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar toInject = settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay); break; case 'flash': pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport flash_vars = pp_images[set_position]; flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length); filename = pp_images[set_position]; filename = filename.substring(0,filename.indexOf('?')); toInject = settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars); break; case 'iframe': pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport frame_url = pp_images[set_position]; frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1); toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url); break; case 'ajax': doresize = false; // Make sure the dimensions are not resized. pp_dimensions = _fitToViewport(movie_width,movie_height); doresize = true; // Reset the dimensions skipInjection = true; $.get(pp_images[set_position],function(responseHTML){ toInject = settings.inline_markup.replace(/{content}/g,responseHTML); $pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject; _showContent(); }); break; case 'custom': pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport toInject = settings.custom_markup; break; case 'inline': // to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete myClone = $(pp_images[set_position]).clone().append('
').css({'width':settings.default_width}).wrapInner('
').appendTo($('body')).show(); doresize = false; // Make sure the dimensions are not resized. pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height()); doresize = true; // Reset the dimensions $(myClone).remove(); toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html()); break; }; if(!imgPreloader && !skipInjection){ $pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject; // Show content _showContent(); }; }); return false; }; /** * Change page in the prettyPhoto modal box * @param direction {String} Direction of the paging, previous or next. */ $.prettyPhoto.changePage = function(direction){ currentGalleryPage = 0; if(direction == 'previous') { set_position--; if (set_position < 0) set_position = $(pp_images).size()-1; }else if(direction == 'next'){ set_position++; if(set_position > $(pp_images).size()-1) set_position = 0; }else{ set_position=direction; }; rel_index = set_position; if(!doresize) doresize = true; // Allow the resizing of the images if(settings.allow_expand) { $('.pp_contract').removeClass('pp_contract').addClass('pp_expand'); } _hideContent(function(){ $.prettyPhoto.open(); }); }; /** * Change gallery page in the prettyPhoto modal box * @param direction {String} Direction of the paging, previous or next. */ $.prettyPhoto.changeGalleryPage = function(direction){ if(direction=='next'){ currentGalleryPage ++; if(currentGalleryPage > totalPage) currentGalleryPage = 0; }else if(direction=='previous'){ currentGalleryPage --; if(currentGalleryPage < 0) currentGalleryPage = totalPage; }else{ currentGalleryPage = direction; }; slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0; slide_to = currentGalleryPage * (itemsPerPage * itemWidth); $pp_gallery.find('ul').animate({left:-slide_to},slide_speed); }; /** * Start the slideshow... */ $.prettyPhoto.startSlideshow = function(){ if(typeof pp_slideshow == 'undefined'){ $pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){ $.prettyPhoto.stopSlideshow(); return false; }); pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow); }else{ $.prettyPhoto.changePage('next'); }; } /** * Stop the slideshow... */ $.prettyPhoto.stopSlideshow = function(){ $pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){ $.prettyPhoto.startSlideshow(); return false; }); clearInterval(pp_slideshow); pp_slideshow=undefined; } /** * Closes prettyPhoto. */ $.prettyPhoto.close = function(){ if($pp_overlay.is(":animated")) return; $.prettyPhoto.stopSlideshow(); $pp_pic_holder.stop().find('object,embed').css('visibility','hidden'); $('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); }); $pp_overlay.fadeOut(settings.animation_speed, function(){ if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash $(this).remove(); // No more need for the prettyPhoto markup $(window).unbind('scroll.prettyphoto'); clearHashtag(); settings.callback(); doresize = true; pp_open = false; delete settings; }); }; /** * Set the proper sizes on the containers and animate the content in. */ function _showContent(){ $('.pp_loaderIcon').hide(); // Calculate the opened top position of the pic holder projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2)); if(projectedTop < 0) projectedTop = 0; $ppt.fadeTo(settings.animation_speed,1); // Resize the content holder $pp_pic_holder.find('.pp_content') .animate({ height:pp_dimensions['contentHeight'], width:pp_dimensions['contentWidth'] },settings.animation_speed); // Resize picture the holder $pp_pic_holder.animate({ 'top': projectedTop, 'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2), width:pp_dimensions['containerWidth'] },settings.animation_speed,function(){ $pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']); $pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content // Show the nav if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); } if(settings.allow_expand) { if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized $('a.pp_expand,a.pp_contract').show(); }else{ $('a.pp_expand').hide(); } } if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow(); settings.changepicturecallback(); // Callback! pp_open = true; }); _insert_gallery(); pp_settings.ajaxcallback(); }; /** * Hide the content...DUH! */ function _hideContent(callback){ // Fade out the current picture $pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden'); $pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){ $('.pp_loaderIcon').show(); callback(); }); }; /** * Check the item position in the gallery array, hide or show the navigation links * @param setCount {integer} The total number of items in the set */ function _checkPosition(setCount){ (setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set. }; /** * Resize the item dimensions if it's bigger than the viewport * @param width {integer} Width of the item to be opened * @param height {integer} Height of the item to be opened * @return An array containin the "fitted" dimensions */ function _fitToViewport(width,height){ resized = false; _getDimensions(width,height); // Define them in case there's no resize needed imageWidth = width, imageHeight = height; if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) { resized = true, fitting = false; while (!fitting){ if((pp_containerWidth > windowWidth)){ imageWidth = (windowWidth - 200); imageHeight = (height/width) * imageWidth; }else if((pp_containerHeight > windowHeight)){ imageHeight = (windowHeight - 200); imageWidth = (width/height) * imageHeight; }else{ fitting = true; }; pp_containerHeight = imageHeight, pp_containerWidth = imageWidth; }; if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){ _fitToViewport(pp_containerWidth,pp_containerHeight) }; _getDimensions(imageWidth,imageHeight); }; return { width:Math.floor(imageWidth), height:Math.floor(imageHeight), containerHeight:Math.floor(pp_containerHeight), containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2), contentHeight:Math.floor(pp_contentHeight), contentWidth:Math.floor(pp_contentWidth), resized:resized }; }; /** * Get the containers dimensions according to the item size * @param width {integer} Width of the item to be opened * @param height {integer} Height of the item to be opened */ function _getDimensions(width,height){ width = parseFloat(width); height = parseFloat(height); // Get the details height, to do so, I need to clone it since it's invisible $pp_details = $pp_pic_holder.find('.pp_details'); $pp_details.width(width); detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom')); $pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({ 'position':'absolute', 'top':-10000 }); detailsHeight += $pp_details.height(); detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details $pp_details.remove(); // Get the titles height, to do so, I need to clone it since it's invisible $pp_title = $pp_pic_holder.find('.ppt'); $pp_title.width(width); titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom')); $pp_title = $pp_title.clone().appendTo($('body')).css({ 'position':'absolute', 'top':-10000 }); titleHeight += $pp_title.height(); $pp_title.remove(); // Get the container size, to resize the holder to the right dimensions pp_contentHeight = height + detailsHeight; pp_contentWidth = width; pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height(); pp_containerWidth = width; } function _getFileType(itemSrc){ if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) { return 'youtube'; }else if (itemSrc.match(/vimeo\.com/i)) { return 'vimeo'; }else if(itemSrc.match(/\b.mov\b/i)){ return 'quicktime'; }else if(itemSrc.match(/\b.swf\b/i)){ return 'flash'; }else if(itemSrc.match(/\biframe=true\b/i)){ return 'iframe'; }else if(itemSrc.match(/\bajax=true\b/i)){ return 'ajax'; }else if(itemSrc.match(/\bcustom=true\b/i)){ return 'custom'; }else if(itemSrc.substr(0,1) == '#'){ return 'inline'; }else{ return 'image'; }; }; function _center_overlay(){ if(doresize && typeof $pp_pic_holder != 'undefined') { scroll_pos = _get_scroll(); contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width(); projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2); if(projectedTop < 0) projectedTop = 0; if(contentHeight > windowHeight) return; $pp_pic_holder.css({ 'top': projectedTop, 'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2) }); }; }; function _get_scroll(){ if (self.pageYOffset) { return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset}; } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft}; } else if (document.body) {// all other Explorers return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}; }; }; function _resize_overlay() { windowHeight = $(window).height(), windowWidth = $(window).width(); if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth); }; function _insert_gallery(){ if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image") { itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin. navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth); itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length; totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1; // Hide the nav in the case there's no need for links if(totalPage == 0){ navWidth = 0; // No nav means no width! $pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide(); }else{ $pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show(); }; galleryWidth = itemsPerPage * itemWidth; fullGalleryWidth = pp_images.length * itemWidth; // Set the proper width to the gallery items $pp_gallery .css('margin-left',-((galleryWidth/2) + (navWidth/2))) .find('div:first').width(galleryWidth+5) .find('ul').width(fullGalleryWidth) .find('li.selected').removeClass('selected'); goToPage = (Math.floor(set_position/itemsPerPage) < totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage; $.prettyPhoto.changeGalleryPage(goToPage); $pp_gallery_li.filter(':eq('+set_position+')').addClass('selected'); }else{ $pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave'); // $pp_gallery.hide(); } } function _build_overlay(caller){ // Inject Social Tool markup into General markup if(settings.social_tools) facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href)); settings.markup = settings.markup.replace('{pp_social}',''); $('body').append(settings.markup); // Inject the markup $pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors // Inject the inline gallery! if(isSet && settings.overlay_gallery) { currentGalleryPage = 0; toInject = ""; for (var i=0; i < pp_images.length; i++) { if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){ classname = 'default'; img_src = ''; }else{ classname = ''; img_src = pp_images[i]; } toInject += "
  • "; }; toInject = settings.gallery_markup.replace(/{gallery}/g,toInject); $pp_pic_holder.find('#pp_full_res').after(toInject); $pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors $pp_gallery.find('.pp_arrow_next').click(function(){ $.prettyPhoto.changeGalleryPage('next'); $.prettyPhoto.stopSlideshow(); return false; }); $pp_gallery.find('.pp_arrow_previous').click(function(){ $.prettyPhoto.changeGalleryPage('previous'); $.prettyPhoto.stopSlideshow(); return false; }); $pp_pic_holder.find('.pp_content').hover( function(){ $pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn(); }, function(){ $pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut(); }); itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin. $pp_gallery_li.each(function(i){ $(this) .find('a') .click(function(){ $.prettyPhoto.changePage(i); $.prettyPhoto.stopSlideshow(); return false; }); }); }; // Inject the play/pause if it's a slideshow if(settings.slideshow){ $pp_pic_holder.find('.pp_nav').prepend('Play') $pp_pic_holder.find('.pp_nav .pp_play').click(function(){ $.prettyPhoto.startSlideshow(); return false; }); } $pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme $pp_overlay .css({ 'opacity':0, 'height':$(document).height(), 'width':$(window).width() }) .bind('click',function(){ if(!settings.modal) $.prettyPhoto.close(); }); $('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; }); if(settings.allow_expand) { $('a.pp_expand').bind('click',function(e){ // Expand the image if($(this).hasClass('pp_expand')){ $(this).removeClass('pp_expand').addClass('pp_contract'); doresize = false; }else{ $(this).removeClass('pp_contract').addClass('pp_expand'); doresize = true; }; _hideContent(function(){ $.prettyPhoto.open(); }); return false; }); } $pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){ $.prettyPhoto.changePage('previous'); $.prettyPhoto.stopSlideshow(); return false; }); $pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){ $.prettyPhoto.changePage('next'); $.prettyPhoto.stopSlideshow(); return false; }); _center_overlay(); // Center it }; if(!pp_alreadyInitialized && getHashtag()){ pp_alreadyInitialized = true; // Grab the rel index to trigger the click on the correct element hashIndex = getHashtag(); hashRel = hashIndex; hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1); hashRel = hashRel.substring(0,hashRel.indexOf('/')); // Little timeout to make sure all the prettyPhoto initialize scripts has been run. // Useful in the event the page contain several init scripts. setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50); } return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once }; function getHashtag(){ var url = location.href; hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false; if(hashtag){ hashtag = hashtag.replace(/<|>/g,''); } return hashtag; }; function setHashtag(){ if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API location.hash = theRel + '/'+rel_index+'/'; }; function clearHashtag(){ if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto"; } function getParam(name,url){ name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( url ); return ( results == null ) ? "" : results[1]; } })(jQuery); var pp_alreadyInitialized = false; // Used for the deep linking to make sure not to call the same function several times.;